<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 条件为false代码执行
      false || console.log("hello1");
      //相当于 if (a===false) console.log("hello1");

      // 条件为true代码执行
      true && console.log("hello2");
      //相当于 if (a===true) console.log("hello2");

      // 条件为undefined代码不执行
      let obj = {
        say() {
          console.log("hello 3");
        },
      };
      obj?.say();
      //相当于 if (a!==undefined) obj.say();;
    </script>
  </body>
</html>
